﻿using System;
using System.Globalization;
using System.Windows.Data;

namespace FxWinSuper.Util
{
	[ValueConversion(typeof(bool), typeof(string))]
	public class BoolToStringConverter : IValueConverter
	{
		public string TrueValue { get; }

		public string FalseValue { get; }

		public BoolToStringConverter(string trueValue, string falseValue)
		{
			TrueValue = trueValue;
			FalseValue = falseValue;
		}

		public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
		{
			bool flag = (bool)value;
			return flag ? TrueValue : FalseValue;
		}

		public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
		{
			string val = value.ToString();
			return val == TrueValue ? true : false;
		}
	}
}
